package org.orz.story.works.biz.clubhouse.web.frontend;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.orz.cloud.common.result.ResultDTO;
import org.orz.story.works.biz.clubhouse.model.req.AddNoteReq;
import org.orz.story.works.biz.clubhouse.model.resp.ListNoteResp;
import org.orz.story.works.biz.clubhouse.service.WorksNoteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Api(tags = "留言接口")
@RequestMapping("clubHouse/worksNote")
@Slf4j
public class WorksNoteController {
    @Autowired
    private WorksNoteService worksNoteService;

    @PostMapping("addNote")
    @ApiOperation("新增留言")
    public ResultDTO<Boolean> addNote(@RequestBody AddNoteReq req){
        worksNoteService.addNote(req);
        return ResultDTO.success();
    }

    @PostMapping("listNote")
    @ApiOperation("查询留言列表")
    public ResultDTO<List<ListNoteResp>> listNote(){
        return ResultDTO.success(worksNoteService.listNote());
    }
}
